<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title></title>
</head>
<link rel="stylesheet" type="text/css" href="/Public/css/index.css"/>
<link rel="stylesheet" type="text/css" href="/Public/css/nav.css"/>
<link rel="stylesheet" type="text/css" href="/Public/css/base.css"/>
<link rel="stylesheet" type="text/css" href="/Public/bootstrap/css/bootstrap.min.css"/>
<link rel="stylesheet" type="text/css" href="/Public/Font-Awesome-3.2.1/css/font-awesome.min.css"/>
<body>

<header>
<div class="nav-box">
	<div class="nav-nav">
		<div class="nav-nav-left">
			<a href=""><img class="logo" src="/Public/css/logo.svg" style="height: 47px;line-height: 47px; width: 90px; padding-left: 0.5em;float: left;"></a>
			<a href="/index.php/Home/share/index" class="item">分享</a>
			<!-- <a href="" class="item">帮助</a>
			<a href="" class="item">建议</a> -->
			<a href="javascript:;" class="finder_box">
					<div class="finder_input">
						<input type="text" class="finder" placeholder="搜索文件"/>	
					</div>
					<div class="finder_btn">
							<i class="icon-search"></i> 
					</div>
			</a>
		</div>
		<div class="nav-nav-right">
			<a href="/index.php/Home/index/edituserinfo">
					<img class="logo" src="<?php echo ($headimg); ?>" style="width: 40px;float: right;border-radius: 50%;margin-top:5px;">
			</a>
<!-- 			<a href="" class="item"><i class="icon-signout"></i></a>
			<a href="" class="item"><i class="icon-envelope"></i></a> -->
			<a href="/index.php/Home/FileAction/quickManage" class="item"><i class="icon-user"></i></a>
			<a href="/index.php/Home/UploadFile/index?#" class="item"><i class="icon-plus"></i></a>
		</div>
	</div>
</div>
</header> 
<div class="container" style="width: 1050px;margin:47px auto">
		<div class="row" >
					<div class="col-md-3">
					<div class="row">
							<div class="col-md-12 m-d-20">
								<div class="media ">
									  <a class="media-left" href="#">
												<img src="<?php echo ($headimg); ?>" class="face" >
									  </a>
									  <div class="media-body">
											<h4 class="media-heading"><?php echo ($nickname); ?></h4>
											<p>加入时间：<?php echo (date('Y-m-d',$addtime )); ?></p>
								  	</div>
								</div>
							</div>
					</div>
					<div class="row">
							<div class="col-md-12 m-d-10">
								<table style="width: 100%;">
									<tr>
										<td>
											<a href="/hlcxxx/followers">
												<div class="follow_num">
													<?php echo ($upload); ?>
													</div>
													<div class="follow_txt">
													Upload
													</div>
											</a>
										</td>
										<td>
											<a href="/hlcxxx/followers">
												<div class="follow_num">
													0
													</div>
													<div class="follow_txt">
													download
													</div>
											</a>
										</td>
										<td>
											<a href="/hlcxxx/followers">
												<div class="follow_num">
													0
													</div>
													<div class="follow_txt">
													Comments
													</div>
											</a>
										</td>
										
									</tr>
								</table>
							</div>
					</div>	
					<div class="row">
						<div class="col-md-12 m-d-20">
							<header id="user-info">
								<div class="user-info-title"><i class="icon-tags"></i>&nbsp;&nbsp;概览</div>
								<div class="user-info-content">
									<ul>
										<!--<li> 
											<a href="" class="content-name"><i class="icon-book"></i> 文献</a> 
											<a href="" class="content-number"> <span>12</span> </a>
										</li>
										
										<li> 
											<a href="" class="content-name"><i class="icon-book"></i> 文献</a> 
											<a href="" class="content-number"> <span>12</span> </a>
										</li>
										
										<li> 
											<a href="" class="content-name"><i class="icon-book"></i> 文献</a> 
											<a href="" class="content-number"> <span>12</span> </a>
										</li>
										
										<li> 
											<a href="" class="content-name"><i class="icon-book"></i> 文献</a> 
											<a href="" class="content-number"> <span>212</span> </a>
										</li>-->
									</ul>
								</div>
							</header>
						</div>
					</div>
				
				</div>
				 
				<div class="col-md-9">
					<h3>个人信息</h3>
					<hr />
					<div class="container">
						<div class="row">
							<div class="col-md-12">
								<form role="form">
								  <div class="form-group">
								    <label for="exampleInputEmail1">昵称:</label>
								    <input type="text" class="form-control" id="nickname" value="<?php echo ($nickname); ?>">
								  </div>
								  <div class="form-group">
								    <label for="exampleInputPassword1">头像:</label>
								    <div id="headimg m-t-20" style="border: 1px dashed #DFDFDF;width: 82px;text-align: center;">
								    	<img src="<?php echo ($headimg); ?>" width="80" height="80" id="uploadPreview" />
								    </div>
								    
										<div class="m-t-10">
											 <input type="file" id="uploadImage"  onchange="handleFiles( )">
										</div>
								   
								  </div>
								  <button type="button" onclick="uploadimg( )" class="btn btn-default">Submit</button>
								  
								</form>
							</div>
						</div>
					</div>
				</div>
		</div>
</div>


<footer>
	<div class="footer">
		
	</div>
	
</footer> 
</body>
<script src="/Public/js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="/Public/bootstrap/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
<script src="/Public/js/ajaxfileupload.js"></script>

<script type="text/javascript">
	oFReader = new FileReader(), rFilter = /^(?:image\/bmp|image\/cis\-cod|image\/gif|image\/ief|image\/jpeg|image\/jpeg|image\/jpeg|image\/pipeg|image\/png|image\/svg\+xml|image\/tiff|image\/x\-cmu\-raster|image\/x\-cmx|image\/x\-icon|image\/x\-portable\-anymap|image\/x\-portable\-bitmap|image\/x\-portable\-graymap|image\/x\-portable\-pixmap|image\/x\-rgb|image\/x\-xbitmap|image\/x\-xpixmap|image\/x\-xwindowdump)$/i;

oFReader.onload = function (oFREvent) {
  document.getElementById("uploadPreview").src = oFREvent.target.result;
};
var oFile;
function handleFiles( ) {
  if (document.getElementById("uploadImage").files.length === 0) { return; }
  
  oFile = document.getElementById("uploadImage").files[0];
  
  if (!rFilter.test(oFile.type)) { alert("You must select a valid image file!"); return; }
  oFReader.readAsDataURL(oFile);
  

}

function uploadimg(){
	 var nickname = $('#nickname').val();
	 var formData = new FormData();
	 if(oFile){
		 formData.append('file', oFile);
	 }
	 
	 formData.append('nickname', nickname);
	  
	 var xhr = new XMLHttpRequest();
    xhr.open('POST', '<?php echo U('changeHeadImg');?>', true);
    xhr.onload = function(e) {  }
    xhr.onerror = function(e) {  }
    xhr.onreadystatechange = function () {
	 		if (xhr.readyState==4 && xhr.status ==200) {
	 			var returninfo = xhr.responseText;
	 			alert(returninfo);
	 		}
 		};
 	
    xhr.upload.onprogress = function(e) {}
    xhr.send(formData);
}


</script>
</html>